package com.project_doctor.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.project_doctor.handler.AnnConverterForExport;
import com.project_doctor.handler.LongListSerializer;
import com.project_doctor.handler.LongListConverter;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;


@Data
@AllArgsConstructor
@NoArgsConstructor
/**
 * @TableName t_system_announcement
 */
@TableName(value ="t_system_announcement")
public class SystemAnnouncement {

    @ExcelProperty("编号")
    private Long id;
    @ExcelProperty("消息标题")
    private String messageTitle;

    @ExcelProperty("消息内容")
    private String messageContent;

    @ExcelProperty("发送人")
    private Long doctorIdSend;

    //JASON处理
    @TableField(typeHandler = JacksonTypeHandler.class)
    @ExcelProperty(value = "接收人", converter = LongListConverter.class)
    @JsonSerialize(using = LongListSerializer.class)
    private List<Long> receiverIds;

    @ExcelProperty(value = "消息状态")
    private Integer status;

    @ExcelProperty("创建时间")
    private Date createTime;
    @ExcelProperty("最后更新时间")
    private Date lastupdateTime;
    @ExcelProperty("发布时间")
    private Date publishTime;
    @ExcelProperty("角色")
    private Long roleId;



    @ExcelProperty(converter = AnnConverterForExport.class)
    @TableField(exist = false,update="false")
    private Role role;

    @ExcelProperty(converter = AnnConverterForExport.class)
    @TableField(exist = false,update="false")
    private Doctor doctor;
}